Report post

Why is innerHTML not working in JavaScript?

Contact JavaScript innerHTML not working The element doesn't exist at the time you're attempting to set a value. You need to call this after the has been added to the DOM. You can either move this tag down further, or add your logic to a function which ought to be called when the document has been loaded:

How to change text in innerHTML?

But innerHTML's parsing/serialisation step can make other operations slower. You can get the same effect by manipulating the DOM. The safest way to change text is to remove all the child nodes of the element and replace them with a new text node.

Is innerHTML faster than Dom?

However, it seems that innerHTML is much faster than the W3C DOM methods: quirksmode.org/dom/innerhtml.html. It depends what you're doing; it's misleading to say one method is blanket better. DOM tends to slow when doing childNode list operations on lots of elements (tending to O (n²)), where innerHTML can do them all at once.

Why am I getting error 'cannot set property 'innerHTML' of undefined'?

@MKA I have added the HTML code for my modal. The "Uncaught TypeError: Cannot set property 'innerHTML' of undefined" error is actually referring to the infoModal.find ('#modal-body') part and not the htmlData part. So, you are getting this error because it is saying that infoModal.find ('#modal-body') does not exist.

The World's Leading Crypto Trading Platform

Get my welcome gifts